﻿using System;
using System.Collections.Concurrent;

namespace Grain.State.BaseModule.StorgeStates
{
    /// <summary>
    /// 计划任务状态
    /// </summary>
    public class RemindersServiceState
    {
        /// <summary>
        /// 计划任务(KeyValue)
        /// </summary>
        public ConcurrentDictionary<string, ReminderInfo> ReminderKeyValue { get; set; } = new ConcurrentDictionary<string, ReminderInfo>();
    }

    public class ReminderInfo
    {
        /// <summary>
        /// 云函数
        /// </summary>
        public string FunctionModuleName { get; set; }

        /// <summary>
        /// 间隔时间（分钟）
        /// </summary>
        public double PeriodOfMinutes { get; set; }

        /// <summary>
        /// 注册时间
        /// </summary>
        public DateTime RegTime { get; set; }

        /// <summary>
        /// 最后一次运行时间
        /// </summary>
        public DateTime? LastRunTime { get; set; }

        /// <summary>
        /// 是否执行成功
        /// </summary>
        public bool? IsRunSuccess { get; set; }

        /// <summary>
        /// 错误信息
        /// </summary>
        public string ErrorInfo { get; set; }
    }
}
